projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
12a3ea5
)
Faster implementation of map-empty-p
author
Nicolas Petton
<nicolas@petton.fr>
Wed, 29 Apr 2015 17:01:56 +0000
(19:01 +0200)
committer
Nicolas Petton
<nicolas@petton.fr>
Wed, 29 Apr 2015 17:05:44 +0000
(19:05 +0200)
* lisp/emacs-lisp/map.el (map-empty-p): Faster implementation using
specific tests depending on the type of the map.
lisp/emacs-lisp/map.el
patch
|
blob
|
history
diff --git
a/lisp/emacs-lisp/map.el
b/lisp/emacs-lisp/map.el
index ff0dc120c8a2aa1f6e6c50887afc122d31847f65..18d2963f46c5401a1bd24019e03d33f99c9912a2 100644
(file)
--- a/
lisp/emacs-lisp/map.el
+++ b/
lisp/emacs-lisp/map.el
@@
-150,7
+150,11
@@
FUNCTION is called with two arguments, the key and the value."
(arrayp map)))
(defun map-empty-p (map)
- (null (map-keys map)))
+ "Return non-nil is MAP is empty."
+ (map--dispatch map
+ :list (null map)
+ :array (seq-empty-p map)
+ :hash-table (zerop (hash-table-count map))))
(defun map-contains-key-p (map key &optional testfn)
"Return non-nil if MAP contain the key KEY, nil otherwise.